<template>
  <el-button type="primary" size="default" @click="MaterialMethods">材料属性定义</el-button>
  <el-button type="primary" size="default" @click="dialogVisible10 = true,WideDefinitionQueryMethods()">宽幅定义</el-button>
  <el-button type="primary" size="default" @click="dialogVisible13 = true,UnitDefinitionQueryMethods()">单位定义</el-button>
  <el-button type="primary" size="default" @click="dialogVisible17 = true,FitProcessingMethodQueryMethods()">贴合加工方式定义</el-button>

  <div style="display: flex">
    <div>
      <Table
        class="table"
        :tableHeader="tableHeader7"
        :tableData="LargeClassDataTableList1"
        :TableHeight="100"
        :outTableHeight="60"
        @currentRow="clicktogetdata"
        :isLoading="isLoading"
      />
    </div>

    <div>
      <Table
        :tableHeader="tableHeader8"
        :tableData="LargeClassDataTableList2"
        :TableHeight="100"
        :outTableHeight="60"
        @currentRow="clicktogetdata1"
        :isLoading="isLoading"
      />
    </div>

    <div>
      <Table
        @download="download"
        @currentRow="clicktogetdata2"
        :tableHeader="tableHeader6"
        :tableData="LargeClassDataTableList3"
        :TableHeight="100"
        :outTableHeight="60"
        :isLoading="isLoading"
      />
    </div>

    <div>
      <Table
        :tableHeader="tableHeader1"
        :tableData="TableListDate1"
        :TableHeight="100"
        :outTableHeight="60"
        :isLoading="isLoading2"
        @download="download1"
      />
    </div>
  </div>

  <!-- 新增 -->
  <el-dialog :close-on-click-modal="false" v-model="dialogVisible2" title="物料属性增加" width="20%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="材料属性" prop="postName">
        <el-select v-model="MaterialPropertyParameterParms.mtlProperty" placeholder="请选择材料属性" size="default" style="width: 240px">
          <el-option
            v-for="item in addMaterialAttributeSelectMethodsTableDate"
            :key="item.id"
            :label="item.mtlProperty"
            :value="item.mtlProperty + ' ' + item.id"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="是否组合">
        <el-checkbox v-model="MaterialPropertyParameterParms1.isMerge" label="" size="large" />
      </el-form-item>
      <el-form-item label="必选否">
        <el-checkbox v-model="MaterialPropertyParameterParms1.propertyNeed" label="" size="large" />
      </el-form-item>
      <el-form-item label="名称组成顺序">
        <el-input v-model="MaterialPropertyParameterParms.propertySeq" placeholder="名称组成顺序" />
      </el-form-item>

      <el-form-item label="是否编码" prop="remark">
        <el-checkbox v-model="MaterialPropertyParameterParms1.mtlNoNeed" label="" size="large" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <!-- 修改 -->
  <el-dialog :close-on-click-modal="false" v-model="dialogVisible3" title="材料属性修改" width="20%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="材料属性" prop="postName">
        <el-select v-model="updateMaterialAttributeParms.mtlProperty" placeholder="请选择材料属性" size="default" style="width: 240px">
          <el-option
            v-for="item in addMaterialAttributeSelectMethodsTableDate"
            :key="item.id"
            :label="item.mtlProperty"
            :value="item.mtlProperty + ' ' + item.id"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="是否组合">
        <el-checkbox v-model="updateMaterialAttributeParms.isMerge" label="" size="large" />
      </el-form-item>
      <el-form-item label="必选否">
        <el-checkbox v-model="updateMaterialAttributeParms.propertyNeed" label="" size="large" />
      </el-form-item>
      <el-form-item label="名称组成顺序">
        <el-input v-model="updateMaterialAttributeParms.propertySeq" placeholder="名称组成顺序" />
      </el-form-item>

      <el-form-item label="是否编码" prop="remark">
        <el-checkbox v-model="updateMaterialAttributeParms.mtlNoNeed" label="" size="large" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="submitForm1">确认修改</el-button>
        <el-button @click="cancel1">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <!-- 材料属性定义 -->
  <el-dialog :close-on-click-modal="false"  
    v-model="dialogVisible5"  
    title="材料属性定义"  
    :height="'200px'"  
    width="70%"  
    class="dialog pb0"  
  >  
    <div style="display: flex; max-height: 500px;"> <!-- 控制弹框内容的最大高度 -->  
      <div style="flex: 1; margin-right: 15px;"> <!-- 左侧 / 第一组内容 -->  
        <el-button type="primary" size="default" @click="dialogVisible6 = true">新增</el-button>  
        <div style="max-height: 400px; overflow-y: auto;"> <!-- 使表格部分能够滚动 -->  
          <Table  
            :tableHeader="tableHeader5"  
            :tableData="MaterialPropertyDefinitionQueryTableDate"  
            :TableHeight="100"  
            :outTableHeight="130"  
            :isLoading="isLoading2"  
            @download="download5"  
            @currentRow="clicktogetdata3"  
          />  
        </div>  
      </div>  

      <div style="flex: 1;"> <!-- 右侧 / 第二组内容 -->  
        <el-button type="primary" size="default" @click="dialogVisible8 = true">新增</el-button>  
        <div style="max-height: 400px; overflow-y: auto;"> <!-- 同样使表格部分能够滚动 -->  
          <Table  
            :tableHeader="tableHeader9"  
            :tableData="MaterialPropertyAssociationQueryTableDate"  
            :isLoading="isLoading2"  
            @download="download8"  
          />  
        </div>  
        <PageModule  
          :PageData="{ total, buttonS: true }"  
          :layout="'prev, pager'"  
          @pageSizeChange="handleSizeChange"  
          @pageChange="handleCurrentChange"  
        />  
      </div>  
    </div>  
  </el-dialog>  

  <!-- 材料属性定义新增 -->-
  <el-dialog :close-on-click-modal="false" v-model="dialogVisible6" title="材料属性定义" width="25%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="序号">
        <el-input v-model="MaterialPropertyDefinitionAddParms.seqNo" placeholder="请输入序号" />
      </el-form-item>
      <el-form-item label="材料属性">
        <el-input v-model="MaterialPropertyDefinitionAddParms.mtlProperty" placeholder="请输入材料属性" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="submitForm5">确 定</el-button>
        <el-button @click="cancel5">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <!-- 材料属性定义修改 -->
  <el-dialog :close-on-click-modal="false" v-model="dialogVisible7" title="材料属性定义修改" width="25%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="序号">
        <el-input v-model="MaterialPropertyDefinitionUpdateParms.seqNo" placeholder="请输入序号" />
      </el-form-item>
      <el-form-item label="材料属性">
        <el-input v-model="MaterialPropertyDefinitionUpdateParms.mtlProperty" placeholder="请输入材料属性" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="MaterialPropertyDefinitionUpdateMethods">确 定</el-button>
        <el-button @click="dialogVisible7 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <!-- 材料属性定义规格新增 -->
  <el-dialog :close-on-click-modal="false" v-model="dialogVisible8" title="材料属性关联规格新增" width="25%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="编号">
        <el-input v-model="MaterialPropertyAssociationAddParms.mtlSeq" placeholder="请输入编号" />
      </el-form-item>
      <el-form-item label="规格">
        <el-input v-model="MaterialPropertyAssociationAddParms.mtlSpec" placeholder="请输入规格" />
      </el-form-item>
      <el-form-item label="排序">
        <el-input v-model="MaterialPropertyAssociationAddParms.sortNo" placeholder="请输入材排序" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="MaterialPropertyDefinitionUpdateMethods1">确 定</el-button>
        <el-button @click="dialogVisible8 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <!-- 材料属性定义规格修改 -->
  <el-dialog :close-on-click-modal="false" v-model="dialogVisible9" title="材料属性关联规格修改" width="25%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="编号">
        <el-input v-model="MaterialPropertyAssociationUpdateParms.mtlSeq" placeholder="请输入编号" />
      </el-form-item>
      <el-form-item label="规格">
        <el-input v-model="MaterialPropertyAssociationUpdateParms.mtlSpec" placeholder="请输入规格" />
      </el-form-item>
      <el-form-item label="排序">
        <el-input v-model="MaterialPropertyAssociationUpdateParms.sortNo" placeholder="请输入材排序" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="MaterialPropertyAssociationUpdateMethods">确 定</el-button>
        <el-button @click="dialogVisible9 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <!-- 宽幅定义 -->
  <el-dialog :close-on-click-modal="false" :height="'200px'"   v-model="dialogVisible10" title="宽幅定义" width="25%" class="dialog pb0">
    <el-button type="primary" size="default" @click="dialogVisible11 = true">新增</el-button>
    <div style="max-height: 400px; overflow-y: auto;">
      <Table
          :tableHeader="tableHeader10"
          :tableData="WideDefinitionQueryTableDate"
          :TableHeight="100"
          :outTableHeight="130"
          :isLoading="isLoading2"
          @download="download20"
          @currentRow="clicktogetdata3"
        />
      </div>
   
        <PageModule  
          :PageData="{ total:total1, buttonS: true }"  
          :layout="'prev, pager'"  
          @pageSizeChange="handleSizeChange1"  
          @pageChange="handleCurrentChange1"  
        />  
  </el-dialog>

  <!-- 宽幅定义新增 -->
  <el-dialog :close-on-click-modal="false" v-model="dialogVisible11" title="宽幅定义新增" width="25%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="编码">
        <el-input v-model="WideDefinitionInterfaceLctParms.mtlSeq" placeholder="请输入编号" />
      </el-form-item>
      <el-form-item label="宽幅">
        <el-input v-model="WideDefinitionInterfaceLctParms.mtlSpec" placeholder="请输入规格" />
      </el-form-item>
      <el-form-item label="排序">
        <el-input v-model="WideDefinitionInterfaceLctParms.sortNo" placeholder="请输入材排序" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="MaterialPropertyDefinitionUpdateMethods11">确 定</el-button>
        <el-button @click="dialogVisible8 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <!-- 宽幅定义修改 -->
  <el-dialog :close-on-click-modal="false" v-model="dialogVisible12" title="宽幅定义修改" width="25%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="编码">
        <el-input v-model="WideDefinitionUpdateMethodsParsms.mtlSeq" placeholder="请输入编号" />
      </el-form-item>
      <el-form-item label="宽幅">
        <el-input v-model="WideDefinitionUpdateMethodsParsms.mtlSpec" placeholder="请输入规格" />
      </el-form-item>
      <el-form-item label="排序">
        <el-input v-model="WideDefinitionUpdateMethodsParsms.sortNo" placeholder="请输入材排序" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="WideDefinitionUpdateMethods">确 定</el-button>
        <el-button @click="dialogVisible12 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <!-- 单位定义 -->
  <el-dialog :close-on-click-modal="false" :height="'200px'"   v-model="dialogVisible13" title="单位定义" width="30%" class="dialog pb0">
    <el-button type="primary" size="default" @click="dialogVisible20 = true">新增</el-button>
    <div style="max-height: 400px; overflow-y: auto;">
      <Table
          :tableHeader="tableHeader11"
          :tableData="UnitDefinitionQueryMethodsTableDate"
          :TableHeight="100"
          :outTableHeight="130"
          :isLoading="isLoading2"
          @download="download6"
          @currentRow="clicktogetdata3"
        />
    </div>
  
        <PageModule  
          :PageData="{ total:total2, buttonS: true }"  
          :layout="'prev, pager'"  
          @pageSizeChange="handleSizeChange2"  
          @pageChange="handleCurrentChange2"  
        />  
  </el-dialog>

  <!-- 单位定义新增 -->
  <el-dialog :close-on-click-modal="false" v-model="dialogVisible16" title="单位定义修改" width="30%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="编码">
        <el-input v-model="UnitDefinitionUpdateParms.mtlSeq" placeholder="请输入编号" />
      </el-form-item>
      <el-form-item label="中文单位">
        <el-input v-model="UnitDefinitionUpdateParms.mtlUnit" placeholder="请输入规格" />
      </el-form-item>
      <el-form-item label="英文单位">
        <el-input v-model="UnitDefinitionUpdateParms.engMtlUnit" placeholder="请输入材排序" />
      </el-form-item>
      <el-form-item label="排序">
        <el-input v-model="UnitDefinitionUpdateParms.sortNo" placeholder="请输入材排序" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="UnitDefinitionUpdateParmsMethods">确 定</el-button>
        <el-button @click="dialogVisible16 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <el-dialog :close-on-click-modal="false" v-model="dialogVisible20" title="单位定义新增" width="30%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="编码">
        <el-input v-model="UnitDefinitionAddParms.mtlSeq" placeholder="请输入编号" />
      </el-form-item>
      <el-form-item label="中文单位">
        <el-input v-model="UnitDefinitionAddParms.mtlUnit" placeholder="请输入规格" />
      </el-form-item>
      <el-form-item label="英文单位">
        <el-input v-model="UnitDefinitionAddParms.engMtlUnit" placeholder="请输入材排序" />
      </el-form-item>
      <el-form-item label="排序">
        <el-input v-model="UnitDefinitionAddParms.sortNo" placeholder="请输入材排序" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="MaterialPropertyDefinitionUpdateMethods12">确 定</el-button>
        <el-button @click="dialogVisible20 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>


  <!-- 单位定义修改 -->
  <el-dialog :close-on-click-modal="false" :height="'200px'"   v-model="dialogVisible17" title="贴合加工方式定义" width="30%" class="dialog pb0">
    <el-button type="primary" size="default" @click="dialogVisible18 = true">新增</el-button> 
    <div style="max-height: 400px; overflow-y: auto;">
      <Table
          :tableHeader="tableHeader12"
          :tableData="FitProcessingMethodQueryTableDate"
          :TableHeight="100"
          :outTableHeight="130"
          :isLoading="isLoading2"
          @download="download7"
          @currentRow="clicktogetdata3"
        />
       
</div>
<PageModule  
          :PageData="{ total:total3, buttonS: true }"  
          :layout="'prev, pager'"  
          @pageSizeChange="handleSizeChange3"  
          @pageChange="handleCurrentChange3"  
        />  
  </el-dialog>

  <!-- 单位定义新增 -->
  <el-dialog :close-on-click-modal="false" v-model="dialogVisible18" title="贴合加工新增" width="25%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="序号">
        <el-input v-model="FitProcessingMethodAddParms.seqNo" placeholder="请输入序号" />
      </el-form-item>
      <el-form-item label="加工方式">
        <el-input v-model="FitProcessingMethodAddParms.prdType" placeholder="请输入加工方式" />
      </el-form-item>
      <el-form-item label="排序">
        <el-input v-model="FitProcessingMethodAddParms.sortNo" placeholder="请输入材排序" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="FitProcessingMethodAddMethods">确 定</el-button>
        <el-button @click="dialogVisible18 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>

  <!-- 单位定义修改 -->
  <el-dialog :close-on-click-modal="false" v-model="dialogVisible19" title="贴合加工修改" width="25%" class="dialog pb0">
    <el-form ref="postRef" :model="form" :rules="rules" label-width="110px">
      <el-form-item label="序号">
        <el-input v-model="FitProcessingMethodUpdateParms.seqNo" placeholder="请输入序号" />
      </el-form-item>
      <el-form-item label="加工方式">
        <el-input v-model="FitProcessingMethodUpdateParms.prdType" placeholder="请输入加工方式" />
      </el-form-item>
      <el-form-item label="排序">
        <el-input v-model="FitProcessingMethodUpdateParms.sortNo" placeholder="请输入材排序" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="FitProcessingMethodUpdateMethods">确 定</el-button>
        <el-button @click="dialogVisible19 = false">取 消</el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
  name: 'DataDefinition'
})
</script>
<script lang="ts" setup>
import { ref, onMounted, reactive, toRefs } from 'vue'
import {
  LargeClassData,
  materialAttribute,
  addMaterialAttribute,
  addMaterialAttributeSelect,
  deleteMaterialAttribute,
  updateMaterialAttribute,
  MaterialPropertyDefinitionQuery,
  MaterialPropertyDefinitionAdd,
  MaterialPropertyDefinitionDelete,
  MaterialPropertyDefinitionUpdate,
  MaterialPropertyAssociationQuery,
  MaterialPropertyAssociationAdd,
  MaterialPropertyAssociationDelete2,
  MaterialPropertyAssociationUpdate,
  WideDefinitionQuery,
  WideDefinitionAdd1,
  WideDefinitionDelete1,
  WideDefinitionUpdate,
  UnitDefinitionQuery,
  UnitDefinitionAdd,
  UnitDefinitionDelete,
  UnitDefinitionUpdate,
  FitProcessingMethodQuery,
  FitProcessingMethodAdd,
  FitProcessingMethodDelete,
  FitProcessingMethodUpdate
} from '@/api/ControlDepartment/MaterialManagement/MaterialAttributeDefinition'
import type {
  LargeClassDataInterface,
  materialAttributeParms,
  materialAttributeInterface,
  MaterialPropertyDefinitionInterface,
  WideDefinitionInterface,
  WideDefinitionInterfaceLct,
  UnitDefinitionInterface,
  FitProcessingMethodInterface
} from '@/api/ControlDepartment/MaterialManagement/MaterialAttributeDefinition'
import { ElMessage } from 'element-plus'
import { ElMessageBox } from 'element-plus'
import {cloneDeep} from 'lodash'
const dialogVisible20 = ref(false)
// 贴合加工方式修改
const FitProcessingMethodUpdateParms = ref()

const FitProcessingMethodUpdateMethods = async() => {
  try {
    const result = await FitProcessingMethodUpdate(FitProcessingMethodUpdateParms.value)
    if(result.code === 200){
      ElMessage.success(result.msg)
      dialogVisible19.value = false
      FitProcessingMethodQueryMethods() 
    }else{
      ElMessage.error(result.msg)
    } 
  } catch{
    ElMessage.error('修改失败')
  }
}

// 贴合加工方式删除
const FitProcessingMethodDeleteParms = ref('')
const handleCloseMateriaLKlc9 = () => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      FitProcessingMethodDeleteMethods()
    })
    .catch(() => {})
}

const dialogVisible19 = ref()

const download7 = (row:any, item:any) => {
     if(item.label === '删除'){
      FitProcessingMethodDeleteParms.value = row.id
      handleCloseMateriaLKlc9()
     }
     if(item.label === '修改'){
      dialogVisible19.value = true
      FitProcessingMethodUpdateParms.value = cloneDeep(row)   
     }
     
}
const FitProcessingMethodDeleteMethods = async() => {
  try {
   const result = await FitProcessingMethodDelete(FitProcessingMethodDeleteParms.value)
   if(result.code === 200){
    ElMessage.success(result.msg)
    FitProcessingMethodQueryMethods() 
   }else{
    ElMessage.error(result.msg)
   }
  } catch (error) {
    ElMessage.error('删除失败')
   }
}

// 贴合方式添加
const dialogVisible18 = ref(false)

const FitProcessingMethodAddParms = ref({
  createTime: "",
  id: 0,
  params: {},
  prdType: "",
  remark: "",
  seqNo: "",
  sortNo: "",
  updateTime: ""
})

const FitProcessingMethodAddMethods = async() => {
  if(FitProcessingMethodAddParms.value.seqNo === '' || FitProcessingMethodAddParms.value.prdType === '' || FitProcessingMethodAddParms.value.sortNo === ''){
    ElMessage.warning('请输入完整数据')
    return 
  }
  try {
    const result = await FitProcessingMethodAdd(FitProcessingMethodAddParms.value) 
    if(result.code === 200){
      FitProcessingMethodAddParms.value.seqNo = ''
      FitProcessingMethodAddParms.value.prdType = ''
      FitProcessingMethodAddParms.value.sortNo = ''
      dialogVisible18.value = false
      ElMessage.success(result.msg)
      FitProcessingMethodQueryMethods() 
    }else{
      ElMessage.error(result.msg)
    }
  } catch{
    ElMessage.error('添加失败')
  }
}

// 贴合加工方式定义查询
const FitProcessingMethodQueryParms = ref({
  createTime: "",
  id: 0,
  params: {},
  prdType: "",
  remark: "",
  seqNo: "",
  sortNo: "",
  updateTime:"",
  pageSize:40,
  currentPage:1
})
const total3 = ref(0)
const handleSizeChange3 = (val: number) => {
  FitProcessingMethodQueryParms.value.pageSize = val
  FitProcessingMethodQueryMethods()
}
const handleCurrentChange3 = (val: number) => {
  FitProcessingMethodQueryParms.value.currentPage = val
  FitProcessingMethodQueryMethods()
}
const FitProcessingMethodQueryTableDate = ref([])

const dialogVisible17 = ref(false)

const FitProcessingMethodQueryMethods = async() => {
 try {
  const result = await FitProcessingMethodQuery(FitProcessingMethodQueryParms.value)
  if(result.rows.length !== 0){
    FitProcessingMethodQueryTableDate.value = result.rows.map((item:any) => {
      item.functionRow = [
          {
            label: '删除'
          },
          {
            label: '修改'
          }
        ]
      return item
    })
    total3.value = result.total
  }else{
    FitProcessingMethodQueryTableDate.value = []
  }
 } catch (error) {
  ElMessage.error('查询失败')
 } 
}


// 单位定义修改
const dialogVisible16 = ref(false)

const UnitDefinitionUpdateParms = ref()

const UnitDefinitionUpdateParmsMethods = async() => {
  try {
    const result = await UnitDefinitionUpdate(UnitDefinitionUpdateParms.value) 
    if(result.code === 200){
      dialogVisible16.value = false
      ElMessage.success(result.msg)
      UnitDefinitionQueryMethods() 
    }else{
      ElMessage.error(result.msg)
    }
  } catch (error) {
    ElMessage.error('修改失败') 
  }
}

const dialogVisible15 = ref(false)
// 单位定义删除
const UnitDefinitionDelete1Parms = ref('')

const download6 = (row: any, item: any) => {
  if (item.label === '删除') {
    UnitDefinitionDelete1Parms.value = row.id
    handleCloseMateriaLKlc8()
  }
  if (item.label === '修改') {
    dialogVisible16.value = true
    UnitDefinitionUpdateParms.value = cloneDeep(row) 
  }
}

const download20 = (row: any, item: any) => {
  if (item.label === '删除') {
    WideDefinitionDelete1Parms.value = row.id
    handleCloseMateriaLKlc3()
  }
  if (item.label === '修改') {
    dialogVisible12.value = true
    WideDefinitionUpdateMethodsParsms.value = cloneDeep(row) 
  }
}

const handleCloseMateriaLKlc8 = () => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      UnitDefinitionDelete1Methods()
    })
    .catch(() => {})
}

const UnitDefinitionDelete1Methods = async () => {
  try {
    const result = await UnitDefinitionDelete(UnitDefinitionDelete1Parms.value) 
    if(result.code === 200){
      ElMessage.success(result.msg)
      UnitDefinitionQueryMethods() 
    }else{
      ElMessage.error(result.msg)
    }
  } catch (error) {
    ElMessage.error('删除失败') 
  }
}

// 单位定义新增
const UnitDefinitionAddParms = ref({
  createTime: "",
  engMtlUnit: "",
  id: 0,
  mtlSeq: "",
  mtlUnit: "",
  params: {},
  remark: "",
  sortNo: "",
  updateTime: ""
})
const UnitDefinitionAddMethods = async() => {
  try {
    const result = await UnitDefinitionAdd(UnitDefinitionAddParms.value) 
    if(result.code === 200){
      dialogVisible20.value = false
      ElMessage.success(result.msg)
      UnitDefinitionAddParms.value.engMtlUnit = ''
      UnitDefinitionAddParms.value.mtlSeq = ''
      UnitDefinitionAddParms.value.mtlUnit = ''
      UnitDefinitionAddParms.value.sortNo = ''
      UnitDefinitionQueryMethods()
    }else{
      ElMessage.error(result.msg)
    }
  } catch (error) {
    ElMessage.error('新增失败') 
  }
}

const MaterialPropertyDefinitionUpdateMethods12 = () => {
  if(UnitDefinitionAddParms.value.mtlSeq === '' || UnitDefinitionAddParms.value.mtlUnit === '' ){
    ElMessage.warning('数据不完善')
    return 
  }
  UnitDefinitionAddMethods()
}

// 单位定义
const dialogVisible13 = ref(false)

const UnitDefinitionQueryMethodsTableDate = ref([])

const UnitDefinitionQueryMethodsTableDateParms = ref({
  createTime: "",
  engMtlUnit: "",
  id: 0,
  mtlSeq: "",
  mtlUnit: "",
  params: {},
  remark: "",
  sortNo: 0,
  updateTime: "",
  pageSize:40,
  currentPage:1
})
const total2 = ref(0)
const handleSizeChange2 = (val: number) => {
  UnitDefinitionQueryMethodsTableDateParms.value.pageSize = val
  UnitDefinitionQueryMethods()
}
const handleCurrentChange2 = (val: number) => {
  UnitDefinitionQueryMethodsTableDateParms.value.currentPage = val
  UnitDefinitionQueryMethods()
}
const UnitDefinitionQueryMethods = async() => {
  try {
    
    const result = await UnitDefinitionQuery(UnitDefinitionQueryMethodsTableDateParms.value)
    if(result.code === 200){
      UnitDefinitionQueryMethodsTableDate.value = result.rows.map((item:any) => {
        item.functionRow = [
          {
            label: '删除'
          },
          {
            label: '修改'
          }
        ]
        return item
      })
      total2.value = result.total
    }
  } catch (error) {
    ElMessage.error('查询失败')
  }
}



// 宽幅定义修改
const WideDefinitionUpdateMethods = async() => {
  try {
    const result = await WideDefinitionUpdate(WideDefinitionUpdateMethodsParsms.value)
    if(result.code === 200){
      ElMessage.success(result.msg)
      WideDefinitionUpdateMethodsParsms.value.mtlSeq = ''
      WideDefinitionUpdateMethodsParsms.value.mtlSpec = ''
      WideDefinitionUpdateMethodsParsms.value.sortNo = ''
      dialogVisible12.value = false 
      WideDefinitionQueryMethods()
    } 
  } catch (error) {
    ElMessage.error('修改失败')
  }
}

const WideDefinitionUpdateMethodsParsms = ref()

// 宽幅定义删除
const WideDefinitionDelete1Parms = ref('')

const WideDefinitionDelete1Methods = async () => {
  const result = await WideDefinitionDelete1(WideDefinitionDelete1Parms.value)
  if (result.code === 200) {
    ElMessage.success(result.msg)
    WideDefinitionQueryMethods() 
  }else{
    ElMessage.error(result.msg)
  } 
}

const dialogVisible12 = ref(false)



const handleCloseMateriaLKlc3 = () => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      WideDefinitionDelete1Methods()
    })
    .catch(() => {})
}

// 宽幅定义新增
const WideDefinitionInterfaceLctParms = ref({
  createTime: "",
  id: 0,
  mtlSeq: "",
  mtlSpec: "",
  params: {},
  remark: "",
  sortNo: "",
  updateTime: ""
})
const WideDefinitionAdd1Methods = async() =>{
  try {
    const result = await WideDefinitionAdd1(WideDefinitionInterfaceLctParms.value) 
    if(result.code === 200){
      WideDefinitionQueryMethods()
      WideDefinitionInterfaceLctParms.value.mtlSeq = ''
      WideDefinitionInterfaceLctParms.value.mtlSpec = ''
      WideDefinitionInterfaceLctParms.value.sortNo = ''
      dialogVisible11.value = false
      ElMessage.success(result.msg) 
    }else{
      ElMessage.error(result.msg)
    }
  }catch (error) {
    ElMessage.error('新增失败')
  }
}

const MaterialPropertyDefinitionUpdateMethods11 = () => {
  if(WideDefinitionInterfaceLctParms.value.mtlSeq === '' || WideDefinitionInterfaceLctParms.value.mtlSpec === ''){
    ElMessage.warning('请输入完整信息')
    return 
  }
  WideDefinitionAdd1Methods()
}

// 宽幅定义
const dialogVisible10 = ref(false)

// 宽幅定义新增
const dialogVisible11 = ref(false)

// 宽幅定义修改
const WideDefinitionQueryTableDate = ref([])

const WideDefinitionInterfaceParms = ref({
  createTime: "",
  id: 0,
  mtlSeq: "",
  mtlSpec: "",
  params: {},
  remark: "",
  sortNo: 0,
  updateTime: "",
  pageSize:40,
  currentPage:1
})

const total1 = ref(0)
const handleSizeChange1 = (val: number) => {
  WideDefinitionInterfaceParms.value.pageSize = val
  WideDefinitionQueryMethods()
}
const handleCurrentChange1 = (val: number) => {
  WideDefinitionInterfaceParms.value.currentPage = val
  WideDefinitionQueryMethods()
}

const WideDefinitionQueryMethods = async() => {
  const result = await WideDefinitionQuery(WideDefinitionInterfaceParms.value)
  if(result.rows.length !== 0){
    WideDefinitionQueryTableDate.value = result.rows.map((item:any) => {
      item.functionRow = [
          {
            label: '删除'
          },
          {
            label: '修改'
          }
        ]
      return item
    })
    total1.value = result.total
  }
}


// 关联规格修改
const MaterialPropertyAssociationUpdateParms = ref()
const dialogVisible9 = ref(false)
const MaterialPropertyAssociationUpdateMethods = async () => {
  try {
    const result = await MaterialPropertyAssociationUpdate(MaterialPropertyAssociationUpdateParms.value) 
    if (result.code === 200) {
      dialogVisible9.value = false
      ElMessage.success(result.msg)
      MaterialPropertyAssociationQueryMethods()
    }else{
      ElMessage.error(result.msg)
    }
  } catch (error) {
    ElMessage.error('修改失败') 
  }
}

// 关联规格删除
const MaterialPropertyAssociationDelete2Parms = ref('')

const MaterialPropertyAssociationDelete2Methods = async () => {
  const result = await MaterialPropertyAssociationDelete2(MaterialPropertyAssociationDelete2Parms.value)
  if (result.code === 200) {
    ElMessage.success(result.msg)
    MaterialPropertyAssociationQueryMethods()
  } else {
    ElMessage.error(result.msg)
  }
}

const handleCloseMateriaLKlc1 = () => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      MaterialPropertyAssociationDelete2Methods()
    })
    .catch(() => {})
}

// 材料属性关联规格新增
const MaterialPropertyAssociationAddParms = ref({
  createTime: '',
  id: 0,
  midId: '',
  mtlSeq: '',
  mtlSpec: '',
  params: {},
  remark: '',
  sortNo: '',
  updateTime: ''
})

const dialogVisible8 = ref(false)

const MaterialPropertyAssociationAddMethods = async () => {
  try {
    const result = await MaterialPropertyAssociationAdd(MaterialPropertyAssociationAddParms.value)
    if (result.code === 200) {
      dialogVisible8.value = false
      MaterialPropertyAssociationAddParms.value.sortNo = ''
      MaterialPropertyAssociationAddParms.value.mtlSeq = ''
      MaterialPropertyAssociationAddParms.value.mtlSpec = ''
      ElMessage.success(result.msg)
      MaterialPropertyAssociationQueryMethods()
    } else {
      ElMessage.error(result.msg)
    }
  } catch (error) {
    ElMessage.error('新增失败')
  }
}

const MaterialPropertyDefinitionUpdateMethods1 = () => {
  if (
    MaterialPropertyAssociationAddParms.value.mtlSeq === '' ||
    MaterialPropertyAssociationAddParms.value.mtlSpec === ''
  ) {
    ElMessage.warning('编号和规格和排序不可为空')
    return
  }
  MaterialPropertyAssociationAddMethods()
}

const download8 = (row: any, item: any) => {
  if (item.label === '新增') {
  }
  if (item.label === '删除') {
    MaterialPropertyAssociationDelete2Parms.value = row.id
    handleCloseMateriaLKlc1()
  }
  if (item.label === '修改') {
    dialogVisible9.value = true
    MaterialPropertyAssociationUpdateParms.value = cloneDeep(row) 
  }
}

// 材料关联规格查询
const MaterialPropertyAssociationQueryMethodsID = ref({
  createTime: '',
  id: 0,
  midId: '',
  mtlSeq: '',
  mtlSpec: '',
  params: {},
  remark: '',
  sortNo: '',
  updateTime: '',
  pageSize:40,
  currentPage:1
})

const MaterialPropertyAssociationQueryTableDate = ref([])
const total = ref(0)
const handleSizeChange = (val: number) => {
  MaterialPropertyAssociationQueryMethodsID.value.pageSize = val
  MaterialPropertyAssociationQueryMethods()
}
const handleCurrentChange = (val: number) => {
  MaterialPropertyAssociationQueryMethodsID.value.currentPage = val
  MaterialPropertyAssociationQueryMethods()
}
const MaterialPropertyAssociationQueryMethods = async () => {
  try {
    const result = await MaterialPropertyAssociationQuery(MaterialPropertyAssociationQueryMethodsID.value)
    console.log(result)
    if (result.code === 200) {
      MaterialPropertyAssociationQueryTableDate.value = result.rows.map((item: any) => {
        item.functionRow = [
          {
            label: '删除'
          },
          {
            label: '修改'
          }
        ]
        return item
      })
      total.value = result.total
    }else{
      total.value = total.value
      ElMessage.error(result.msg)
    }
    
  } catch (error) {
    ElMessage.error('查询失败')
  }
}

const clicktogetdata3 = (row: any) => {
  MaterialPropertyAssociationQueryMethodsID.value.id = row.id
  MaterialPropertyAssociationQueryMethodsID.value.midId = row.id
  MaterialPropertyAssociationAddParms.value.midId = row.id
  MaterialPropertyAssociationQueryMethods()
}

// 材料属性修改
const MaterialPropertyDefinitionUpdateParms = ref()

const MaterialPropertyDefinitionUpdateMethods = async () => {
  try {
    const result = await MaterialPropertyDefinitionUpdate(MaterialPropertyDefinitionUpdateParms.value)
    if (result.code === 200) {
      addMaterialAttributeSelectMethods()
      dialogVisible7.value = false
      ElMessage.success(result.msg)
    } else {
      ElMessage.error(result.msg)
    }
  } catch (error) {
    ElMessage.error('修改失败')
  }
}

// 材料属性定义删除
const deleteMaterialPropertyDefinitionMethodsParms = ref('')

const deleteMaterialPropertyDefinitionMethods = async () => {
  try {
    const result = await MaterialPropertyDefinitionDelete(deleteMaterialPropertyDefinitionMethodsParms.value)
    if (result.code === 200) {
      ElMessage.success(result.msg)
      addMaterialAttributeSelectMethods()
    } else {
      ElMessage.error(result.msg)
    }
  } catch {
    ElMessage.error('删除失败')
  }
}

// 材料属性定义新增
const dialogVisible6 = ref(false)

const MaterialPropertyDefinitionAddParms = ref({
  createTime: '',
  id: 0,
  mtlProperty: '',
  params: {},
  remark: '',
  seqNo: '',
  updateTime: ''
})

const submitForm5 = () => {
  if (MaterialPropertyDefinitionAddParms.value.seqNo === '' || MaterialPropertyDefinitionAddParms.value.mtlProperty === '') {
    ElMessage.warning('序号不能为空并且材料属性不可为空')
    return
  }
  MaterialPropertyDefinitionAddMethods()
}

const cancel5 = () => {
  dialogVisible6.value = false
}

const dialogVisible7 = ref(false)

const download5 = (row: any, item: any) => {
  if (item.label === '新增') {
  }
  if (item.label === '删除') {
    deleteMaterialPropertyDefinitionMethodsParms.value = row.id
    handleCloseMateriaLKlc()
  }
  if (item.label === '修改') {
    dialogVisible7.value = true
    MaterialPropertyDefinitionUpdateParms.value = cloneDeep(row) 
  }
}

const handleCloseMateriaLKlc = () => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      deleteMaterialPropertyDefinitionMethods()
    })
    .catch(() => {})
}

const MaterialPropertyDefinitionAddMethods = async () => {
  try {
    const result = await MaterialPropertyDefinitionAdd(MaterialPropertyDefinitionAddParms.value)
    if (result.code === 200) {
      dialogVisible6.value = false
      MaterialPropertyDefinitionAddParms.value.seqNo = ''
      MaterialPropertyDefinitionAddParms.value.mtlProperty = ''
      addMaterialAttributeSelectMethods()
      ElMessage.success(result.msg)
    } else {
      ElMessage.error(result.msg)
    }
  } catch (error) {
    ElMessage.error('新增失败')
  }
}

// 材料属性定义
const dialogVisible5 = ref(false)

const MaterialPropertyDefinitionQueryTableDate = ref([])

const addMaterialAttributeSelectMethodsTableDate = ref<any>([])

const MaterialMethods = () => {
  dialogVisible5.value = true
  // MaterialPropertyDefinitionQueryMehtods()
  MaterialPropertyAssociationQueryMethods()
}

// const MaterialPropertyDefinitionQueryMehtods = async() => {
//     try {
//         const result = await MaterialPropertyDefinitionQuery()
//         if(result.code === 200){
//             MaterialPropertyDefinitionQueryTableDate.value = result.data
//         }else{
//             ElMessage.error(result.msg)
//         }
//     } catch (error) {
//         ElMessage.error('查询失败')
//     }
// }

// 材料属性修改
const updateMaterialAttributeParms = ref()

const updateMaterialAttributeMethods = async () => {
  try {
    const result = await updateMaterialAttribute(updateMaterialAttributeParms.value)
    if (result.code === 200) {
      MaterialPropertyMethod()
      dialogVisible3.value = false
      ElMessage.success(result.msg)
    } else {
      ElMessage.error(result.msg)
    }
  } catch (error) {
    ElMessage.error('修改失败请重试')
  }
}

const submitForm1 = () => {
  delete updateMaterialAttributeParms.value.functionRow
  console.log(updateMaterialAttributeParms.value.mtlProperty)
  if (typeof updateMaterialAttributeParms.value.mtlProperty === 'string' && updateMaterialAttributeParms.value.mtlProperty.includes(' ')) {
    updateMaterialAttributeParms.value.mtlId = updateMaterialAttributeParms.value.mtlProperty.split(' ')[1]
    updateMaterialAttributeParms.value.mtlProperty = updateMaterialAttributeParms.value.mtlProperty.split(' ')[0]
  }

  updateMaterialAttributeParms.value.propertyNeed = updateMaterialAttributeParms.value.propertyNeed ? 'Y' : null
  updateMaterialAttributeParms.value.mtlNoNeed = updateMaterialAttributeParms.value.mtlNoNeed ? 'Y' : null
  updateMaterialAttributeParms.value.isMerge = updateMaterialAttributeParms.value.isMerge ? 'Y' : null
  console.log(updateMaterialAttributeParms.value)
  updateMaterialAttributeMethods()
}

// 材料属性查询
const value = ref('')
const addMaterialAttributeSelectMethods = async () => {
  try {
    const result = await addMaterialAttributeSelect()
    addMaterialAttributeSelectMethodsTableDate.value = result.data
    MaterialPropertyAssociationQueryMethodsID.value.midId = result.data[0].id
    MaterialPropertyAssociationAddParms.value.midId = result.data[0].id
    MaterialPropertyDefinitionQueryTableDate.value = result.data.map((item: any) => {
      item.functionRow = [
        {
          label: '删除'
        },
        {
          label: '修改'
        }
      ]
      return item
    })
  } catch (error) {
    ElMessage.error('材料属性查询出错')
  }
}

// 材料属性删除

const deleteMaterialAttributeMethodsParms = ref('')

const deleteMaterialAttributeMethods = async () => {
  try {
    const result = await deleteMaterialAttribute(deleteMaterialAttributeMethodsParms.value)
    if (result.code === 200) {
      ElMessage.success(result.msg)
      MaterialPropertyMethod()
    } else {
      ElMessage.error(result.msg)
    }
  } catch (error) {
    ElMessage.error('删除失败')
  }
}

// 新增弹框
const dialogVisible2 = ref(false)

const submitForm = () => {
  if (MaterialPropertyParameterParms.value.propertySeq === '' || MaterialPropertyParameterParms.value.mtlProperty === null) {
    return ElMessage.warning('名称组成顺序不可为空或材料属性不可为空')
  }
  MaterialPropertyParameterParms.value.mtlId = MaterialPropertyParameterParms.value.mtlProperty.split(' ')[1]
  MaterialPropertyParameterParms.value.mtlProperty = MaterialPropertyParameterParms.value.mtlProperty.split(' ')[0]
  MaterialPropertyParameterParms.value.propertyNeed = MaterialPropertyParameterParms1.value.propertyNeed ? 'Y' : null   
  MaterialPropertyParameterParms.value.mtlNoNeed = MaterialPropertyParameterParms1.value.mtlNoNeed ? 'Y' : null
  MaterialPropertyParameterParms.value.isMerge = MaterialPropertyParameterParms1.value.isMerge ? 'Y' : null

  // 在这里调用你的添加方法，但确保不要重置状态
  addMaterialAttributeMethods()
}

const cancel = () => {
  dialogVisible2.value = false
}

// 新增
const MaterialPropertyParameterParms1 = ref({
  propertyNeed: '',
  mtlNoNeed: '',
  isMerge:''
})
const MaterialPropertyParameterParms = ref<any>({
  createTime: '',
  id: 0,
  mtlId: '',
  mtlNoNeed: '',
  mtlProperty: '',
  params: {},
  propertyNeed: '',
  propertySeq: '',
  remark: '',
  seqNo: '',
  typeId: '',
  updateTime: ''
})

const data = reactive({
  form: {},
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    postCode: undefined,
    postName: undefined,
    status: undefined
  },
  rules: {
    postName: [{ required: true, message: '材料属性不能为空', trigger: 'blur' }],
    postSort: [{ required: true, message: '名称组成顺序不可为空', trigger: 'blur' }]
  }
})

const { queryParams, form, rules } = toRefs(data)

const addMaterialAttributeMethods = async () => {
  const result = await addMaterialAttribute(MaterialPropertyParameterParms.value)
  if (result.code === 200) {
    MaterialPropertyParameterParms.value.mtlId = ''
    MaterialPropertyParameterParms.value.mtlNoNeed = ''
    MaterialPropertyParameterParms.value.mtlProperty = ''
    MaterialPropertyParameterParms.value.propertyNeed = ''
    MaterialPropertyParameterParms.value.propertySeq = ''
    MaterialPropertyParameterParms1.value.propertyNeed = ''
    MaterialPropertyParameterParms1.value.mtlNoNeed = ''
    dialogVisible2.value = false
    ElMessage.success(result.msg)
    MaterialPropertyMethod()
  } else {
    ElMessage.error(result.msg)
  }
}

const download = (row: any, item: any) => {
  if (item.label === '新增') {
    MaterialPropertyParameterParms.value.typeId = row.typeId
    dialogVisible2.value = true
  }
}

const LargeClassDataMethodsData = ref([])

const MaterialPropertyParameter = ref('')

const MaterialPropertyMethod = async () => {
  
  const result = await materialAttribute(MaterialPropertyParameter.value)
  console.log(result)
  if (result.data.length === 0) {
    TableListDate1.value = []
  } else {
    TableListDate1.value = result.data.map((item: any) => {
      if (item.propertyNeed === 'Y') {
        item.propertyNeed = true
      } else {
        item.propertyNeed = false
      } 
      if (item.mtlNoNeed === 'Y') {
        item.mtlNoNeed = true
      } else {
        item.mtlNoNeed = false
      }

      if (item.isMerge === 'Y') {
        item.isMerge = true
      } else {
        item.isMerge = false
      }

      item.functionRow = [
        {
          label: '删除'
        },
        {
          label: '修改'
        }
      ]
      return item
    })
  }
}

const isLoading = ref(true)

const LargeClassDataTableList1 = ref<LargeClassDataInterface[]>()

const LargeClassDataTableList2 = ref<any>([])

const LargeClassDataTableList3 = ref<any>([])

const TableListDate1 = ref<any[]>()

const dialogVisible3 = ref(false)

const download1 = (row: any, item: any) => {
  if (item.label === '删除') {
    deleteMaterialAttributeMethodsParms.value = row.id
    handleCloseMateriaLKlc5()
  }
  if (item.label === '修改') {
    dialogVisible3.value = true
    updateMaterialAttributeParms.value = cloneDeep(row) 
  }
}

const cancel1 = () => {
  dialogVisible3.value = false
}

const handleCloseMateriaLKlc5 = () => {
  ElMessageBox.confirm('确认要删除吗?')
    .then(async () => {
      deleteMaterialAttributeMethods()
    })
    .catch(() => {})
}

const isLoading2 = ref(false)

const tableHeader1 = ref([
  {
    label: '材料属性',
    prop: 'mtlProperty'
  },
  {
    label: '是否组合',
    type: 'svg',
    prop: 'isMerge'
  },
  {
    label: '必选否',
    type: 'svg',
    prop: 'propertyNeed'
  },
  {
    label: '名称组成顺序',
    prop: 'propertySeq'
  },
  {
    label: '是否编码',
    type: 'svg',
    prop: 'mtlNoNeed'
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: 200
  }
])

const tableHeader5 = ref([
  {
    label: '序号',
    prop: 'seqNo'
  },
  {
    label: '材料属性',
    prop: 'mtlProperty'
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: 200
  }
])

const tableHeader11 = ref([
  {
    label: '编码',
    prop: 'mtlSeq'
  },
  {
    label: '中文单位',
    prop: 'mtlUnit'
  },
  {
    label: '英文单位',
    prop: 'engMtlUnit'
  },
  {
    label: '排序',
    prop: 'sortNo'
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: 200
  }
])

const tableHeader12 = ref([
  {
    label: '序号',
    prop: 'seqNo'
  },
  {
    label: '加工方式',
    prop: 'prdType'
  },
  {
    label: '排序',
    prop: 'sortNo'
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: 200
  }
])

const tableHeader10 = ref([
  {
    label: '编码',
    prop: 'mtlSeq'
  },
  {
    label: '宽幅',
    prop: 'mtlSpec'
  },
  {
    label: '排序',
    prop: 'sortNo'
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: 200
  }
])

const tableHeader9 = ref([
  {
    label: '编号',
    prop: 'mtlSeq'
  },
  {
    label: '规格',
    prop: 'mtlSpec'
  },
  {
    label: '排序',
    prop: 'sortNo'
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    width: 200
  }
])

const tableHeader7 = ref([
  {
    label: '大类',
    prop: 'typeName',
    width: '100'
  }
])

const tableHeader8 = ref([
  {
    label: '中类',
    prop: 'typeName',
    width: '100'
  }
])

const tableHeader6 = ref([
  {
    label: '小类',
    prop: 'typeName',
    width: '100'
  },
  {
    label: '操作',
    prop: 'outSum',
    type: 'functionRow',
    height: '25px'
  }
])

const clicktogetdata = (row: any) => {
  LargeClassDataTableList2.value = row.children

  if (LargeClassDataTableList2.value.length === 0) {
    LargeClassDataTableList3.value = []
  } else {
    LargeClassDataTableList3.value =
      row.children[0].children.map((item: any) => {
        item.functionRow = [
          {
            label: '新增'
          }
        ]
        return item
      }) || []

    MaterialPropertyParameter.value = row.children[0].children[0].typeId
    MaterialPropertyMethod()
  }
}

const clicktogetdata1 = (row: any) => {
  LargeClassDataTableList3.value =
    row.children.map((item: any) => {
      item.functionRow = [
        {
          label: '新增',
          
        }
      ]
      return item
    }) ||
    [] ||
    []
  if (row.children.length !== 0) {
    MaterialPropertyParameter.value = row.children[0].typeId
    MaterialPropertyMethod()
  }else{
    TableListDate1.value = []
  }
}

// 数据查询

const clicktogetdata2 = (row: any) => {
  MaterialPropertyParameter.value = row.typeId
  MaterialPropertyMethod()
}

const LargeClassDataMethods = async () => {
  isLoading.value = true

  const result = await LargeClassData()

  if (result.data.length !== 0) {
    LargeClassDataTableList1.value = result.data
    if (result.data.length !== 0) {
      LargeClassDataTableList2.value = result.data[0].children

      LargeClassDataTableList3.value = result.data[0].children[0].children.map((item: any) => {
        item.functionRow = [
          {
            label: '新增'
          }
        ]
        return item
      })
      MaterialPropertyParameter.value = result.data[0].children[0].children[0].typeId
      MaterialPropertyMethod()
    }
  }
  isLoading.value = false
}
onMounted(() => {
  LargeClassDataMethods()

  addMaterialAttributeSelectMethods()
})

const handleNodeClick = (data: any) => {
  console.log(data)
}

const defaultProps = {
  children: 'children',
  label: 'typeName'
}
</script>

<style lang="less" scoped>
h1 {
  font-size: 16px;
}
</style>
